<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/home_sharing_system/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
var cnt = 1;
function addFile(){
	var add = document.getElementById("add");
	var addfile = document.createElement("input");
	var br = document.createElement("br");
	addfile.setAttribute("type", "file");
	addfile.setAttribute("name", "upfile["+cnt+"]");
	add.appendChild(addfile);
	add.appendChild(br);
	cnt++;
}

function filedelete(){
	if(window.confirm("사진을 삭제하시겠습니까?")){
		
	}else{
		
	}
}

	
</script>
</head>
<body>
<h2>회원님의 객실 정보</h2>
<h4>등록하신 객실사진 입니다. </h4>
 <font color="red">※ 객실사진을 삭제하시려면 해당 사진을 클릭해주세요. </font><p>
<form action="/Project_homeshare_room/modifyroominputfileup.do" name="form2" method="post">
	<c:forEach items="${requestScope.flist }" var="fdto" varStatus="cnt">				
		<c:choose>
			<c:when test="${cnt.count==1 }">
				<a href="deleteFile.do?filename=${fdto.fileName }&roomNo=${fdto.roomNo}"><img width="600px" height="400px" src="/Project_homeshare_room/uproomfile/${fdto.fileName }" onclick=return filedelete()></a><br>
				
			</c:when>
			<c:otherwise>
				<a href="deleteFile.do?filename=${fdto.fileName }&roomNo=${fdto.roomNo}"><img width="300px" height="200px" src="/Project_homeshare_room/uproomfile/${fdto.fileName }" onclick=return filedelete()></a>
			</c:otherwise>
		</c:choose>
	</c:forEach><br>
	<hr>
</form>	

<form action="/Project_homeshare_room/modifyroominputfileup.do" name="form" method="post" enctype="multipart/form-data">
	<h4>객실사진을 추가할 수 있습니다.</h4>
	<input type="hidden" name="roomNo" value=${param.roomNo }><br>
<table bgcolor="#F5FFFA" cellpadding="10" cellspacing="0">
	<tr>
	<td><div id="add">
	<input type="file" name="upfile[0]" id="first"><br>
	</div></td>
	</tr>
	<tr>
	<td><input type="button" value="사진파일추가" onclick="addFile()"></td></tr>
</table>
<p>
	<input type="submit" value="등록">	
</form>

</body>
</html>